package com.Controller;

import com.Service.StuWorkloadService;
import com.entity.StuWorkload;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/subject")
public class StuWorkloadController {
    @Autowired
    private StuWorkloadService stuWorkloadService;

    /**
     * 查询
     * @param stuWorkload
     * @return
     */
    @RequestMapping(value = "/queryStuWorkload",method = RequestMethod.GET)
    public List<StuWorkload> queryStuWorkload(StuWorkload stuWorkload){
        return stuWorkloadService.queryStuWorkload(stuWorkload);
    }

    /**
     * 新增
     * @param stuWorkload
     * @return
     */
    @RequestMapping(value = "/addStuWorkload",method = RequestMethod.POST)
    public int addStuWorkload(@RequestBody StuWorkload stuWorkload){
        return stuWorkloadService.addStuWorkload(stuWorkload);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @RequestMapping(value = "/delStuWorkload/{id}",method = RequestMethod.DELETE)
    public int delStuWorkload(@PathVariable int id){
        return stuWorkloadService.delStuWorkload(id);
    }

    /**
     * 修改
     * @param stuWorkload
     * @return
     */
    @RequestMapping(value = "/updateStuWorkload/{id}",method = RequestMethod.PUT)
    public int updateStuWorkload(@RequestBody StuWorkload stuWorkload,@PathVariable int id){
        stuWorkload.setStuWorkId(id);
        return stuWorkloadService.updateStuWorkload(stuWorkload);
    }
}
